package com.example.cash.craft.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 积分记录
 */
@Data
@TableName("reward_points_log")
public class RewardPointsLog implements Serializable {

    /**
     * 积分记录ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 关联的订单ID
     */
    private Long orderId;

    /**
     * 积分变动（正数为增加，负数为减少）
     */
    private Integer pointsChange;

    /**
     * 积分变动描述
     */
    private String description;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 最后修改时间
     */
    private LocalDateTime updateTime;

    /**
     * 积分变动描述枚举
     */
    public enum Description {

        CONSUME_DEDUCTION("消费扣减积分"),
        CONSUME_FEEDBACK("消费回馈积分");

        private String description;

        Description(String description) {
            this.description = description;
        }

        public String getDescription() {
            return description;
        }
    }

}